/**使用mysql模块 */
const mysql = require("mysql");
/**创建连接池，配置连接信息 */
let pool = mysql.createPool({
    host:"localhost",
    port:3306,
    user:"root",
    password:"root",
    database:"db-system"
})
let insertSql = "INSERT INTO users(userName,age,sex)values (?,?,?)";
let userName = "wanglujie";
let age = 15;
let sex ="male";
pool.query(insertSql,[userName,age,sex],(err,result,fields)=>{
    if(err){
        console.log(err);
    }
    else{
        console.log(result);
        console.log(fields);
    }
})